{layout name="layout" /}
{if $type == 1}
<textarea readonly class="width">
{$content}
</textarea>
{else /}
<fieldset class="layui-elem-field">
    <legend>分层代码</legend>
    <div class="layui-field-box">
        1、撰写业务逻辑等。（建议在公共区域）<br>
        1、生成的文件或代码，是调用模块下的model，如果没选模块则调用全局model。<br>
    </div>
</fieldset>
<form  class="layui-form" action="{:url('layered_code1')}" method="post">
    <div class="layui-form-item" style="width: 30%;">
        <label class="layui-form-label">选择模块：</label>
        <div class="layui-input-block">
            <select name="mokuai">
                <option value="">选择模块</option>
                {volist name="mokuai" id="vo"}
                <option value="{$vo}">{$vo}</option>
                {/volist}
            </select>
            <span style="color: red;">未选择默认为全局模块</span>
        </div>
    </div>
    <div class="layui-form-item" style="width: 30%;">
        <label class="layui-form-label">选择表：</label>
        <div class="layui-input-block">
            <select name="table">
                <option value="">选择表</option>
                {volist name="tables" id="vo"}
                <option value="{$vo.Name}">{$vo.Name} -- {$vo.Comment}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="modelfiles">分层代码生成</button>
        </div>
    </div>
</form>
<script>
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(modelfiles)', function(data){
            console.log(data)
            if(data.field.table == ''){
                layer.msg('请选择表')
                return false;
            }
            return true;
        });
    });
</script>
{/if}

